package com.wst.wst_server;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.OutputFile;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.util.Collections;

@SpringBootApplication
@MapperScan("com.wst.wst_server.mapper")
public class WstSeverApplication {

    public static void main(String[] args) {
        SpringApplication.run(WstSeverApplication.class, args);
//        mp_genertor();
    }
    private static void mp_genertor() {
        FastAutoGenerator.create("jdbc:mysql://127.0.0.1:3307/wst", "root", "123456")
                .globalConfig(builder -> {
                    builder.author("zyk") // 设置作者
                            .enableSwagger() // 开启 swagger 模式
                            .fileOverride() // 覆盖已生成文件
                            .outputDir("D:\\Aprojects\\wst\\wst_sever\\src\\main\\java\\"); // 指定输出目录
                })
                .packageConfig(builder -> {
                    builder.parent("com.wst") // 设置父包名
                            .moduleName("wst_server") // 设置父包模块名
                            .pathInfo(Collections.singletonMap(OutputFile.xml, "D:\\Aprojects\\wst\\wst_sever\\src\\main\\java\\com\\wst\\wst_server\\mapper\\")); // 设置mapperXml生成路径
                })
                .strategyConfig(builder -> {
                    builder.addInclude("leader", "money", "org","orgplus","person","section"); // 设置需要生成的表名
                    //.addTablePrefix("t_", "c_"); // 设置过滤表前缀
                })
                .templateEngine(new FreemarkerTemplateEngine()) // 使用Freemarker引擎模板，默认的是Velocity引擎模板
                .execute();
    }

}
